/**
 * Copyright 2012 [name of copyright owner]
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 **/

package com.qwiki.page;

import java.util.HashMap;

/**
 * @author xgu
 *
 * May 28, 2012
 */
public enum NameSpace
{
  Media(-2),
  Special(-1),
  Undefined(0),
  Talk(1),
  User(2),
  User_talk(3),
  Wikipedia(4),
  Wikipedia_talk(5),
  File(6),
  File_talk(7),
  MediaWiki(8),
  MediaWiki_talk(9),
  Template(10),
  Template_talk(11),
  Help(12),
  Help_talk(13),
  Category(14),
  Category_talk(15),
  Portal(100),
  Portal_talk(101),
  Book(108),
  Book_talk(109);
  
  private static HashMap<Integer, NameSpace> map = new HashMap<Integer, NameSpace>();
  static
  {
    for (NameSpace ns : NameSpace.values())
    {
      map.put(ns.getID(), ns);
    }
  }
  private final int id;

  NameSpace(int id)
  {
    this.id = id;
  }

  public int getID()
  {
    return id;
  }

  public NameSpace getEnum(int id)
  {
    return map.get(id);
  }
}
